package com.gsdl.model.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

// TODO: Auto-generated Javadoc
/**
 * The Class Material.
 *
 * @author Natacha Antonopoulos
 */

@Entity
@Table(name = "material")
@NamedQueries( 
	    {   
	        @NamedQuery(name = "Material.findByCentro", query = "SELECT DISTINCT m FROM Material m, Stock s WHERE s.material.id = m.id AND s.deposito.centro.id = :centroId" )
	    }
	 )
public class Material extends BaseEntity implements Serializable{
	
	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -5443885585769427272L;

	/** The categoria. */
	@ManyToOne
	@JoinColumn(name = "id_categoria", referencedColumnName = "id", nullable=false)
	private CategoriaMaterial categoria = new CategoriaMaterial();
	
	/** The nome. */
	@Column(name="nome", nullable=false)
	private String nome;
	
	/** The preco. */
	@Column(name="preco")
	private Double preco;
	
	/** The limite. */
	@Column(name="limite")
	private Long limite = 0L;

	/**
	 * Gets the categoria.
	 *
	 * @return the categoria
	 */
	public CategoriaMaterial getCategoria() {
		return categoria;
	}

	/**
	 * Sets the categoria.
	 *
	 * @param categoria the categoria to set
	 */
	public void setCategoria(CategoriaMaterial categoria) {
		this.categoria = categoria;
	}

	/**
	 * Gets the nome.
	 *
	 * @return the nome
	 */
	public String getNome() {
		return nome;
	}

	/**
	 * Sets the nome.
	 *
	 * @param nome the nome to set
	 */
	public void setNome(String nome) {
		this.nome = nome;
	}

	/**
	 * Gets the preco.
	 *
	 * @return the preco
	 */
	public Double getPreco() {
		return preco;
	}

	/**
	 * Sets the preco.
	 *
	 * @param preco the preco to set
	 */
	public void setPreco(Double preco) {
		this.preco = preco;
	}

	/**
	 * Gets the limite.
	 *
	 * @return the limite
	 */
	public Long getLimite() {
		return limite;
	}

	/**
	 * Sets the limite.
	 *
	 * @param limite the limite to set
	 */
	public void setLimite(Long limite) {
		this.limite = limite;
	}

	
}
